from interface.MemberInterface import MemberInterface
from utils.SendMethod import SendMethod


class AddressInterface:
    def __init__(self, url, headers):
        self.url = url
        self.headers = headers

    def get_add_address(self, url, json):
        method = "post"
        url = self.url + "/member/address/add"
        return SendMethod.sendmethod(method=method, url=url, json=json, headers=self.headers)


if __name__ == '__main__':
    url = "http://47.108.206.100:8085"
    headers = MemberInterface(url).get_member_token("Anna", "anna123")
    print(headers)
    address = AddressInterface(url, headers)
    json = {
        "city": "湖北武汉",  # 城市
        "defaultStatus": 0,  # 默认状态
        "detailAddress": "源码时代",  # 详细的地址
        "id": 0,
        "memberId": 1853,  # 姓名id
        "name": "Anna",  # 姓名
        "phoneNumber": "18569945662",  # 手机号码
        "postCode": "430000",  # 邮政编码
        "province": "湖北省",  # 省份
        "region": "武汉市江夏区"  # 地区/范围
    }
    print(address.get_add_address(url, json))
